package kr.co.doriclassic.chpater22test;

import java.util.HashMap;
import java.util.Map;

class Student{
	int number;
	String name;
	public Student(int number, String name) {
		this.number = number;
		this.name = name;
	}
	
	@Override
	public String toString() {
		return String.format("%s", name);
	}	
}

public class MapTest {
	public static void main(String[] args) {
		Map<String, Student> st = new HashMap<String, Student>();
		
		st.put("20090001", new Student(2009001, "구준표"));
		st.put("20090002", new Student(2009002, "금잔디"));
		st.put("20090003", new Student(2009003, "윤지후"));
		
		
		st.remove("20090001");
		
		st.put("20090001", new Student(20090001, "소이정"));
		
		System.out.println(st.get("20090003"));
		
		for (Map.Entry<String, Student> s : st.entrySet()) {
			String k=s.getKey();
			Student v=s.getValue();
			System.out.println(k+""+v);
		}

	}
}
